package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class 包子凑数 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       final static int N=110,M=100010;
       static boolean f[][]=new boolean[N][M];
       static int n,a[]=new int[N];
       
       static int gcd(int a,int b){
    	      return b>0?gcd(b,a%b):a;
       }
       public static void main(String[] args) throws NumberFormatException, IOException {
		      n=Integer.parseInt(br.readLine());
		      int d=0;
		      for(int i=1;i<=n;i++){
		    	  a[i]=Integer.parseInt(br.readLine());
		    	  d=gcd(a[i],d);
		      }
		      if(d!=1){
		    	  System.out.print("INF");
		    	  return;
		      }
		      f[0][0]=true;
		      for(int i=1;i<=n;i++)
		    	  for(int j=0;j<M;j++){
		    		  f[i][j]=f[i-1][j];
		    		  if(j-a[i]>=0)
		    			  f[i][j]=f[i][j]||f[i][j-a[i]];
		    	  }
		      int res=0;
		      for(int j=0;j<M;j++){
		    	  boolean flag=false;
		    	  for(int i=1;i<=n;i++){
		    		  if(f[i][j]){
		    			  flag=true;
		    			  break;
		    		  }
		    	  }
		    	  if(!flag)res++;
		      }
		      System.out.print(res);
	}
       
}
